package Com.Isman.Adapter;

import java.util.List;

import Com.Isman.Booking.R;
import Com.Isman.WebService.ComplexType.Order;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.Toast;

public class HotelOrderAdapter extends BaseAdapter {

    private final Context context;
    private final List<Order> list;
    
    public HotelOrderAdapter(Context contact, List<Order> list){
    	this.context = contact;
    	this.list = list;
    }
    
	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
        final Order entry = list.get(position);
        
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.itemorderlist, null);
        }
        
        //findResource
        TextView roomname 	= (TextView)convertView.findViewById(R.id.lblItemOrderRoomName);
        TextView id			= (TextView)convertView.findViewById(R.id.lblItemOrderID);
        TextView checkIn	= (TextView)convertView.findViewById(R.id.lblItemOrderChechIn);
        TextView checkOut 	= (TextView)convertView.findViewById(R.id.lblItemOrderChechOut);
        TextView hotelname	= (TextView)convertView.findViewById(R.id.lblItemOrderHotelName);
        TextView amount		= (TextView)convertView.findViewById(R.id.lblItemOrderAmount);
        
  
        //Set value. 
/*        roomname.setText(entry.getRoomName());
        hotelname.setText(entry.getHotelName());
        id.setText(entry.getOrderID()+"");
        checkIn.setText(entry.getCheckIn());
        checkOut.setText(entry.getCheckOut());
        amount.setText("US "+entry.getAmount());*/

        convertView.setOnClickListener(new  View.OnClickListener() { 
        	@Override
			public void onClick(View v) {
        		Toast.makeText(v.getContext(), "Click", Toast.LENGTH_SHORT).show();
        	}
		});
        return convertView;
	}
}
